package com.codeplex.springsurv.dataaccess.mappers;

import java.sql.SQLException;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.codeplex.springsurv.*;

public interface SurveysMapper {
	
	public Survey getSurveyById(@Param(value = "id") Long pId) throws SQLException;
	
	public List<Survey> getSurveysListNotFilledByUser(@Param(value = "strNick") String pStrNick) throws SQLException;
	
	public List<Question> getQuestionListBySurvId(@Param(value = "id") Long pId) throws SQLException;
	
	public List<Answer> getAnswerListByQuestId(@Param(value = "id" ) Long pId) throws SQLException;
	
	public void insertSurvey(@Param(value = "surv") Survey pSurv) throws SQLException;
	
	public void insertQuestion(@Param(value = "quest") Question pQuest, @Param(value = "survId") Long pSurvId) throws SQLException;
	
	public void insertAnswer(@Param(value = "answ") Answer pAnsw, @Param(value = "questId") Long pQuestId) throws SQLException;
	
	public Long getLastSurvId() throws SQLException;
	
	public Long getLastQuestId() throws SQLException;
	
	public Long getLastAnswId() throws SQLException;
	
	public void closeSurvey(@Param(value = "surveyId") Long pSurvId) throws SQLException;
	
	public Integer getQuantByAnsId(@Param(value = "ansId") Long pAnsId) throws SQLException;
	
	public void insertFilledSurvey(@Param(value = "usSurvNick") String pUsSurvNick, @Param(value = "usSurvSurvId") Long pUsSurvSurvId, @Param(value = "usSurvAnswId") Long pUsSurvAnswId) throws SQLException;
	
	public Integer getQuantUsersBySurvId(@Param(value = "survId") Long pSurvId) throws SQLException;
	
	public Long getSurvIdByQuestId(@Param(value = "id") Long pId) throws SQLException;
	
	public String getSurvUserNickBySurvId(@Param(value = "id") Long pId) throws SQLException;
	
	public List<Survey> getSurveysListByUserCreator(@Param(value = "strNick") String pStrNick) throws SQLException;
}
